﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAO;

namespace WEB.Restrito.Login
{
    public partial class Login : PaginaBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    onload();
                }
            }
            catch (Exception ex)
            {
                lblErro.Text = ex.Message;
            }
        }



        #region Funções
        public void onload()
        {
            try
            {
                EventoDAO.Listar(ddlEvento);

            }
            catch (Exception)
            {
                throw;
            }
        }
        #endregion

        protected void btnLogar_Click(object sender, EventArgs e)
        {
            try
            {
                fazLogin(int.Parse(ddlEvento.SelectedValue.ToString()), txtEmail.Text.Trim(), txtSenha.Text.Trim());
                Response.Redirect("~/Restrito/Default.aspx");
            }
            catch (Exception ex)
            {
                lblErro.Text = ex.Message;
            }
            

        }
    }


}